
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>11.1高效使用 Packages指南 · Flutter for Harmony教程</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="坚果派">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mind-maps/mindmaps.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-lou/lou.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"ITmxs/gitbook","types":["star","watch","fork"],"size":"small"};
    </script>

    </head>
    <body>
         
<div class="donate-modal modal">
  <div class="modal-header">
    <div>
      <span>
        <img
          id="modal-avatar"
          class="modal-avatar"
          src="http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/avatar-100.png"
        />
      </span>
      <span id="nickname"> breeze </span>
      <p class="modal-close close" onclick="closeDonateModal()">×</p>
    </div>
    <div class="message">
      <div class="tip">
        <i></i>
        <span>随意打赏，但不要超过一顿早餐钱 💕</span>
      </div>
    </div>
  </div>
  <div class="modal-content">
    <div class="modal-pay-way">
      <div id="wxpay" onclick="showDonateImg(0)">
        <input
          type="radio"
          name="pay-way"
          value="wxpay"
          class="zs-type"
          checked="checked"
        />
        <span>
          <img
            id="wxpay-logo"
            src=""
          />
        </span>
      </div>
      <div id="alipay" onclick="showDonateImg(1)">
        <input type="radio" name="pay-way" value="alipay" class="zs-type" />
        <span>
          <img
            id="alipay-logo"
            src=""
          />
        </span>
      </div>
    </div>
    <div class="modal-pay-qrcode">
      <img id="wxpay-code" src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png" />
      <img
        id="alipay-code"
        src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202843746.png"
        hidden
      />
    </div>
  </div>
</div>
<div class="mask"></div>


<div class="book">
  <div class="header-inner">
    <!-- LOGO -->
    <div class="logo"></div>
    <span class="title"></span>

    <!-- Search -->
    
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>


    <!-- Nav -->
    <ul class="header-nav">
      <li>
        <a href="https://www.gitbook.com/" target="_blank">坚果派官网</a>
      </li><li>
        <a href="https://www.npmjs.com/package/package" target="_blank">ArkUI实战</a>
      </li><li>
        <a href="https://space.bilibili.com/480883651" target="_blank">元服务开发实践</a>
      </li><li>
        <a href="https://blog.51cto.com/jianguo" target="_blank">OpenHarmony应用开发</a>
      </li>
    </ul>
  </div>

  <div class="book-summary">
    <div class="book-summary-title">文档目录</div>
     
    <nav role="navigation">


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    1.前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../坚果派介绍.html">
            
                <a href="../坚果派介绍.html">
            
                    
                    2.坚果派介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    3.Flutter与Dart介绍
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../chapter3/3.1Flutter介绍.html">
            
                <a href="../chapter3/3.1Flutter介绍.html">
            
                    
                    3.1Flutter介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../chapter3/3.2Dart介绍.html">
            
                <a href="../chapter3/3.2Dart介绍.html">
            
                    
                    3.2Dart介绍
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    4.HarmonyOS/OpenHarmony与ArkTS介绍
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter4/4.1HarmonyOS">
            
                <span>
            
                    
                    4.1HarmonyOS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter4/4.2OpenHarmony.html">
            
                <a href="../chapter4/4.2OpenHarmony.html">
            
                    
                    4.2OpenHarmony
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../chapter4/4.3HarmonyOSNEXT.html">
            
                <a href="../chapter4/4.3HarmonyOSNEXT.html">
            
                    
                    4.3HarmonyOS NEXT
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../chapter4/4.4ArkTS语言 .html">
            
                <a href="../chapter4/4.4ArkTS语言 .html">
            
                    
                    4.4ArkTS语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../chapter4/4.5三者的差异 .md">
            
                <span>
            
                    
                    4.5三者的区别与联系
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    5.Flutter鸿蒙化
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <span>
            
                    
                    [5.1背景]
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" >
            
                <span>
            
                    
                    [5.2原理]
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../chapter2/2.3Impeller渲染引擎.html">
            
                <a href="../chapter2/2.3Impeller渲染引擎.html">
            
                    
                    5.3Impeller渲染引擎
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    6.鸿蒙Flutter开发环境配置（windows与mac）
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../chapter5/5.1windows环境配置.html">
            
                <a href="../chapter5/5.1windows环境配置.html">
            
                    
                    6.1windows环境配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../chapter5/5.2mac环境配置.html">
            
                <a href="../chapter5/5.2mac环境配置.html">
            
                    
                    6.2 mac环境配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../chapter5/5.6使用最新的fluttersdk配置开发环境.html">
            
                <a href="../chapter5/5.6使用最新的fluttersdk配置开发环境.html">
            
                    
                    6.3 使用 FlutterSDK 3.22.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../chapter5/5.4第一个鸿蒙Flutter应用程序.html">
            
                <a href="../chapter5/5.4第一个鸿蒙Flutter应用程序.html">
            
                    
                    6.4第一个鸿蒙Flutter应用程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../chapter5/5.5鸿蒙Flutter运行到HarmonyOS.md">
            
                <span>
            
                    
                    6.5运行到多平台
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../chapter5/5.7OpenHarmony设备运行指导.html">
            
                <a href="../chapter5/5.7OpenHarmony设备运行指导.html">
            
                    
                    6.6OpenHarmony设备运行指导
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../chapter5/5.8现有项目支持鸿蒙.html">
            
                <a href="../chapter5/5.8现有项目支持鸿蒙.html">
            
                    
                    6.7现有Flutter项目支持鸿蒙
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../chapter5/5.9鸿蒙版Flutter仓库变更.html">
            
                <a href="../chapter5/5.9鸿蒙版Flutter仓库变更.html">
            
                    
                    6.8鸿蒙版Flutter仓库变更
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../chapter5/5.11使用fvm.html">
            
                <a href="../chapter5/5.11使用fvm.html">
            
                    
                    6.9使用FVM管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    7.在鸿蒙应用中添加Flutter页面
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" >
            
                <span>
            
                    
                    7.1如何使用 FlutterPage
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" >
            
                <span>
            
                    
                    7.2如何使用混合开发添加跳转 FlutterEntry
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" >
            
                <span>
            
                    
                    7.3 harmonyos添加flutter页面跳转时路由的处理
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" >
            
                <span>
            
                    
                    8.在鸿蒙应用中使用Flutter Channel能力
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../chapter8/8.1如何使用Flutter与鸿蒙通信 FlutterChannel.html">
            
                <a href="../chapter8/8.1如何使用Flutter与鸿蒙通信 FlutterChannel.html">
            
                    
                    8.1如何使用Flutter与鸿蒙通信 FlutterChannel
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../chapter8/8.4 混合渲染开发实践：以 fluttertpc_scan 三方库为例.html">
            
                <a href="../chapter8/8.4 混合渲染开发实践：以 fluttertpc_scan 三方库为例.html">
            
                    
                    8.4 混合渲染开发实践：以 fluttertpc_scan 三方库为例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" >
            
                <span>
            
                    
                    9.与原生混合渲染
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/Flutter OHOS外接纹理适配简介.md">
            
                    
                    9.1Flutter OHOS外接纹理适配简介.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/如何使用多引擎 FlutterEngineGroup.md">
            
                    
                    9.2如何使用多引擎 FlutterEngineGroup
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/如何使用PlatformView.md">
            
                    
                    9.3如何使用PlatformView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/PlatformView同层渲染方案适配切换指导.md">
            
                    
                    9.4PlatformView同层渲染方案适配切换指导
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" >
            
                <span>
            
                    
                    9.5如何使用混合开发 module
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    10.开发Flutter静态库
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/如何使用混合开发 module.md">
            
                    
                    10.1开发module
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/开发package.md">
            
                    
                    10.2开发package
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/开发plugin.md">
            
                    
                    10.3开发plugin
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" >
            
                <a target="_blank" href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/开发FFI plugin.md">
            
                    
                    10.4开发FFI plugin
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" >
            
                <span>
            
                    
                    11.Packages使用指南
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.11.1" data-path="11.1高效使用 Packages指南.html">
            
                <a href="11.1高效使用 Packages指南.html">
            
                    
                    11.1高效使用 Packages指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" >
            
                <span>
            
                    
                    11.2发布Packages
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" >
            
                <span>
            
                    
                    12.鸿蒙适配Flutter三方库
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../chapter12/12.1纯dart库无需迁移.html">
            
                <a href="../chapter12/12.1纯dart库无需迁移.html">
            
                    
                    12.1纯dart库无需迁移
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../chapter12/12.2坚果派已适配的库">
            
                <span>
            
                    
                    12.2坚果派目前适配三方库进展
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="../chapter12/12.3适配三方库之FlutterToast.html">
            
                <a href="../chapter12/12.3适配三方库之FlutterToast.html">
            
                    
                    12.3适配三方库之FlutterToast
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="../chapter12/12.4适配适配三方库之udid.md">
            
                <span>
            
                    
                    12.4适配三方库之udid
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.5" data-path="../chapter12/12.5适配torch_light.html">
            
                <a href="../chapter12/12.5适配torch_light.html">
            
                    
                    12.5适配torch_light.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.6" data-path="../chapter12/12.6适配flutter_native_contact_picker.html">
            
                <a href="../chapter12/12.6适配flutter_native_contact_picker.html">
            
                    
                    12.6适配flutter_native_contact_picker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.7" data-path="../chapter12/12.7适配flutter_timezone.html">
            
                <a href="../chapter12/12.7适配flutter_timezone.html">
            
                    
                    12.7适配flutter_timezone.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.8" data-path="../chapter12/12.8适配flutter_exit_app.html">
            
                <a href="../chapter12/12.8适配flutter_exit_app.html">
            
                    
                    12.8适配flutter_exit_app.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.9" data-path="../chapter12/12.9适配flutter_phone_direct_caller.html">
            
                <a href="../chapter12/12.9适配flutter_phone_direct_caller.html">
            
                    
                    12.9适配flutter_phone_direct_caller
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.10" data-path="../chapter12/12.10适配flutter_app_icon_badge.html">
            
                <a href="../chapter12/12.10适配flutter_app_icon_badge.html">
            
                    
                    12.10适配flutter_app_icon_badge
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.11" data-path="../chapter12/12.11适配memory_info.html">
            
                <a href="../chapter12/12.11适配memory_info.html">
            
                    
                    12.11适配memory_info
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" >
            
                <span>
            
                    
                    13.1DevTool使用
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" >
            
                <span>
            
                    
                    13.1DevTool使用
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/05_performance/performance-delimitation.md">
            
                    
                    13.2性能分析定界(OpenHarmony平台)指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/05_performance/performance-threads-sequence.md">
            
                    
                    13.3性能分析第一步-梳理线程顺序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.4" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/05_performance/performance-frame-rendering-tracking.md">
            
                    
                    13.4性能分析-帧渲染跟踪
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.5" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/05_performance/performance-sliding-response-time.md">
            
                    
                    13.5性能分析-滑动响应时延
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.6" data-path="../chapter12/12.6如何调试代码">
            
                <span>
            
                    
                    13.6如何调试代码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" >
            
                <span>
            
                    
                    14.迁移实战
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" >
            
                <span>
            
                    
                    坚果驾考
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../chapter14/14.2使用url_launcher.html">
            
                <a href="../chapter14/14.2使用url_launcher.html">
            
                    
                    14.2使用url_launcher
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../chapter14/14.3flutter开发鸿蒙PC应用.html">
            
                <a href="../chapter14/14.3flutter开发鸿蒙PC应用.html">
            
                    
                    14.3flutter开发鸿蒙PC应用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" >
            
                <span>
            
                    
                    15.上架审核
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" >
            
                <span>
            
                    
                    16.FAQ
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.1" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/environment.md">
            
                    
                    16.1环境相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.2" data-path="../chapter16/16.3权限相关.html">
            
                <a href="../chapter16/16.3权限相关.html">
            
                    
                    16.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.3" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/ohos_engine.md">
            
                    
                    ohos引擎产物编译相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.4" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/ohos_hap.md">
            
                    
                    ohos应用编译相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.5" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/ohos_code.md">
            
                    
                    ohos代码开发相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.6" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/ohos_run.md">
            
                    
                    ohos运行相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.7" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/README.md">
            
                    
                    功能开发相关问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.8" >
            
                <a target="_blank" href="https://gitee.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/08_FAQ/flutter_cppcrash_guideline.md">
            
                    
                    解析flutter相关的cppcrash堆栈
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.17" >
            
                <span>
            
                    
                    17.阅读更多
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" >
            
                <span>
            
                    
                    现有Flutter项目支持鸿蒙
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../chapter17/17.2平台判断与问题处理指南.html">
            
                <a href="../chapter17/17.2平台判断与问题处理指南.html">
            
                    
                    17.2平台判断与问题处理指南
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.18" >
            
                <span>
            
                    
                    18.关于未来
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.18.1" >
            
                <span>
            
                    
                    致谢
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>

</nav>
     
  </div>

  <!-- Content nav -->
  <div class="book-anchor">
    <div class="book-anchor-title"></div>

    <div class="book-anchor-body"></div>
  </div>

  <div class="book-body">
    
    <div class="body-inner">
       

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >11.1高效使用 Packages指南</a>
    </h1>
</div>



      <div class="page-wrapper" tabindex="-1" role="main">
        <div class="page-inner">
          
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
          <section class="normal markdown-section">
             
                <div id="vip-container">
                    <h1 id="&#x9E3F;&#x8499;&#x7248;flutter&#x9AD8;&#x6548;&#x4F7F;&#x7528;-packages&#x6307;&#x5357;"><a name="&#x9E3F;&#x8499;&#x7248;flutter&#x9AD8;&#x6548;&#x4F7F;&#x7528;-packages&#x6307;&#x5357;" class="plugin-anchor" href="#&#x9E3F;&#x8499;&#x7248;flutter&#x9AD8;&#x6548;&#x4F7F;&#x7528;-packages&#x6307;&#x5357;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x9E3F;&#x8499;&#x7248;Flutter&#x9AD8;&#x6548;&#x4F7F;&#x7528; Packages&#x6307;&#x5357;</h1>
<p>&#x5728;&#x9E3F;&#x8499;&#x7248; Flutter &#x5F00;&#x53D1;&#x4E2D;&#xFF0C;&#x5408;&#x7406;&#x4F7F;&#x7528; Packages &#x53EF;&#x4EE5;&#x663E;&#x8457;&#x63D0;&#x5347;&#x5F00;&#x53D1;&#x6548;&#x7387;&#x548C;&#x5E94;&#x7528;&#x529F;&#x80FD;&#x3002;&#x4EE5;&#x4E0B;&#x662F;&#x5982;&#x4F55;&#x5728;&#x9E3F;&#x8499;&#x7248; Flutter &#x4E2D;&#x4F7F;&#x7528; Packages &#x7684;&#x8BE6;&#x7EC6;&#x6307;&#x5357;&#x3002;</p>
<p>&#x5168;&#x6587;&#x6211;&#x5C31;&#x7528;&#x575A;&#x679C;&#x6D3E;&#x4ED3;&#x5E93;&#x4E0B;&#x7684;&#x4E09;&#x65B9;&#x5E93;&#x4EE5;&#x53CA;pub&#x4E0B;&#x7684;&#x7EAF;dart&#x5E93;&#x6765;&#x505A;&#x6F14;&#x793A;&#x3002;</p>
<h2 id="&#x4E00;&#x3001;&#x4EC0;&#x4E48;&#x662F;-packages"><a name="&#x4E00;&#x3001;&#x4EC0;&#x4E48;&#x662F;-packages" class="plugin-anchor" href="#&#x4E00;&#x3001;&#x4EC0;&#x4E48;&#x662F;-packages"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E00;&#x3001;&#x4EC0;&#x4E48;&#x662F; Packages</h2>
<h3 id="dart-packages"><a name="dart-packages" class="plugin-anchor" href="#dart-packages"><i class="fa fa-link" aria-hidden="true"></i></a>Dart Packages</h3>
<p>Dart Packages &#x662F;&#x4E00;&#x7EC4;&#x4EE3;&#x7801;&#x7684;&#x96C6;&#x5408;&#xFF0C;&#x901A;&#x5E38;&#x5305;&#x542B;&#x5E93;&#x3001;&#x5DE5;&#x5177;&#x548C;&#x5176;&#x4ED6;&#x8D44;&#x6E90;&#xFF0C;&#x7528;&#x4E8E;&#x5B9E;&#x73B0;&#x7279;&#x5B9A;&#x529F;&#x80FD;&#x3002;Dart package &#x6700;&#x4F4E;&#x8981;&#x6C42;&#x662F;&#x5305;&#x542B;&#x4E00;&#x4E2A; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x3002;&#x6B64;&#x5916;&#xFF0C;&#x4E00;&#x4E2A; package &#x53EF;&#x4EE5;&#x5305;&#x542B;&#x4F9D;&#x8D56;&#x5173;&#x7CFB; (&#x5728; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x91CC;&#x58F0;&#x660E;)&#x3001; Dart &#x5E93;&#x3001;&#x5E94;&#x7528;&#x3001;&#x8D44;&#x6E90;&#x3001;&#x5B57;&#x4F53;&#x3001;&#x6D4B;&#x8BD5;&#x3001;&#x56FE;&#x7247;&#x548C;&#x4F8B;&#x5B50;&#x7B49;&#x3002; <a href="https://pub-web.flutter-io.cn/" target="_blank">pub.dev</a> &#x4E0A;&#x5217;&#x51FA;&#x4E86;&#x5F88;&#x591A; package&#xFF0C;&#x7531; Google &#x5DE5;&#x7A0B;&#x5E08;&#x548C; Flutter &#x548C; Dart &#x793E;&#x533A;&#x7684;&#x5F00;&#x53D1;&#x8005;&#x5F00;&#x53D1;&#x548C;&#x53D1;&#x5E03;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x7528;&#x5728;&#x81EA;&#x5DF1;&#x7684;&#x5E94;&#x7528;&#x91CC;&#x3002;</p>
<h3 id="plugins"><a name="plugins" class="plugin-anchor" href="#plugins"><i class="fa fa-link" aria-hidden="true"></i></a>Plugins</h3>
<p>&#x63D2;&#x4EF6; (plugin package) &#x662F;&#x4E00;&#x79CD;&#x7279;&#x522B;&#x7684; package&#xFF0C;&#x7279;&#x522B;&#x6307;&#x90A3;&#x4E9B;&#x5E2E;&#x52A9;&#x4F60;&#x83B7;&#x5F97;&#x539F;&#x751F;&#x5E73;&#x53F0;&#x7279;&#x6027;&#x7684; package&#x3002;&#x63D2;&#x4EF6;&#x53EF;&#x4EE5;&#x4E3A; HarmonyOS&#x3001;Android (&#x4F7F;&#x7528; Kotlin &#x6216; Java &#x8BED;&#x8A00;)&#x3001; iOS (&#x4F7F;&#x7528; Swift &#x6216; Objective-C &#x8BED;&#x8A00;)&#x3001;Web&#x3001;macOS&#x3001;Windows&#x3001;Linux &#x5E73;&#x53F0;&#xFF0C;&#x6216;&#x5176;&#x4EFB;&#x610F;&#x7EC4;&#x5408;&#x7684;&#x5E73;&#x53F0;&#x7F16;&#x5199;&#x3002;&#x6BD4;&#x5982;&#xFF1A;&#x67D0;&#x4E2A;&#x63D2;&#x4EF6;&#x53EF;&#x4EE5;&#x4E3A; Flutter &#x5E94;&#x7528;&#x63D0;&#x4F9B;&#x4F7F;&#x7528;&#x539F;&#x751F;&#x5E73;&#x53F0;&#x7684;&#x53D1;&#x9001;&#x77ED;&#x4FE1;&#x7684;&#x80FD;&#x529B;&#x3002;</p>
<p>&#x73B0;&#x6709;&#x7684; package &#x652F;&#x6301;&#x8BB8;&#x591A;&#x4F7F;&#x7528;&#x573A;&#x666F;&#xFF0C;&#x4F8B;&#x5982;&#xFF0C;&#x7F51;&#x7EDC;&#x8BF7;&#x6C42; (<a href="https://docs.flutter.cn/cookbook/networking/fetch-data" target="_blank"><code>http</code></a>)&#xFF0C;&#x81EA;&#x5B9A;&#x4E49;&#x5BFC;&#x822A;/&#x8DEF;&#x7531;&#x5904;&#x7406; (<a href="https://pub-web.flutter-io.cn/packages/go_router" target="_blank"><code>go_router</code></a>)&#xFF0C;&#x96C6;&#x6210;&#x8BBE;&#x5907; API&#xFF08;&#x5982; <a href="https://pub-web.flutter-io.cn/packages/url_launcher" target="_blank"><code>url_launcher</code></a> &#x548C; <a href="https://pub-web.flutter-io.cn/packages/battery_plus" target="_blank"><code>battery_plus</code></a>&#xFF0C;&#x4EE5;&#x53CA;&#x4F7F;&#x7528;&#x7B2C;&#x4E09;&#x65B9;&#x5E73;&#x53F0;&#x7684; SDK</p>
<h2 id="&#x4E8C;&#x3001;&#x4F7F;&#x7528;-package"><a name="&#x4E8C;&#x3001;&#x4F7F;&#x7528;-package" class="plugin-anchor" href="#&#x4E8C;&#x3001;&#x4F7F;&#x7528;-package"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E8C;&#x3001;&#x4F7F;&#x7528; package</h2>
<h3 id="&#x641C;&#x7D22;-package"><a name="&#x641C;&#x7D22;-package" class="plugin-anchor" href="#&#x641C;&#x7D22;-package"><i class="fa fa-link" aria-hidden="true"></i></a>&#x641C;&#x7D22; package</h3>
<p>&#x901A;&#x5E38;Package &#x4F1A;&#x88AB;&#x53D1;&#x5E03;&#x5230; <a href="https://pub-web.flutter-io.cn/" target="_blank">pub.dev</a> &#x7F51;&#x7AD9;&#x4E0A;&#x3002;</p>
<p>Pub &#x7F51;&#x7AD9;&#x4E0A;&#x7684; <a href="https://pub-web.flutter-io.cn/flutter" target="_blank">Flutter &#x9875;&#x9762;</a> &#x5C55;&#x793A;&#x4E86;&#x4E0E; Flutter &#x517C;&#x5BB9;&#x7684; package&#xFF08;&#x5373;&#x58F0;&#x660E;&#x7684;&#x4F9D;&#x8D56;&#x901A;&#x5E38;&#x4E0E; Flutter &#x517C;&#x5BB9;&#xFF09;&#xFF0C;&#x5E76;&#x4E14;&#x6240;&#x6709;&#x5DF2;&#x53D1;&#x5E03;&#x7684; package &#x90FD;&#x652F;&#x6301;&#x641C;&#x7D22;&#x3002;</p>
<p>Pub.dev &#x4E0A;&#x7684; <a href="https://pub-web.flutter-io.cn/flutter/favorites" target="_blank">Flutter Favorites</a> &#x9875;&#x9762;&#x5217;&#x51FA;&#x4E86;&#x4E00;&#x7CFB;&#x5217;&#x7F16;&#x5199;&#x5E94;&#x7528;&#x65F6;&#x53EF;&#x4EE5;&#x9996;&#x5148;&#x8003;&#x8651;&#x4F7F;&#x7528;&#x7684;&#x63D2;&#x4EF6;&#x548C; package&#x3002;</p>
<p>&#x5728; pub.dev &#x7F51;&#x7AD9;&#x4E0A;&#x4F60;&#x53EF;&#x4EE5;&#x540C;&#x65F6;&#x8FC7;&#x6EE4;&#x51FA;&#x9002;&#x5408; <a href="https://pub-web.flutter-io.cn/packages?q=sdk%3Aflutter+platform%3Aandroid" target="_blank">Android</a>&#x3001;<a href="https://pub-web.flutter-io.cn/packages?q=sdk%3Aflutter+platform%3Aios" target="_blank">iOS</a>&#x3001;<a href="https://pub-web.flutter-io.cn/packages?q=sdk%3Aflutter+platform%3Aweb" target="_blank">Web</a>&#x3001;<a href="https://docs.flutter.cn/packages-and-plugins/using-packages?q=sdk%3Aflutter+platform%3Alinux" target="_blank">Linux</a>&#x3001; <a href="https://pub-web.flutter-io.cn/packages?q=sdk%3Aflutter+platform%3Awindows" target="_blank">Windows</a> &#x6216; <a href="https://pub-web.flutter-io.cn/packages?q=sdk%3Aflutter+platform%3Amacos" target="_blank">macOS</a> &#x7684;&#x63D2;&#x4EF6;&#xFF0C;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x590D;&#x9009;&#x6846;&#xFF0C;&#x8FC7;&#x6EE4;&#x51FA;&#x7EC4;&#x5408;&#x7ED3;&#x679C;&#xFF08;&#x9002;&#x914D;&#x4E00;&#x4E2A;&#x6216;&#x8005;&#x591A;&#x4E2A;&#x5E73;&#x53F0;&#xFF09;&#x3002;&#x76EE;&#x524D;&#x6709;&#x70B9;&#x9057;&#x61BE;&#x7684;&#x662F;&#x76EE;&#x524D;&#x8FD8;&#x4E0D;&#x652F;&#x6301;&#x7B5B;&#x9009;&#x51FA;&#x652F;&#x6301;HarmonyOS&#x6216;OpenHarmony&#x7684;&#x4E09;&#x65B9;&#x5E93;&#x3002;&#x5373;&#x4F7F;&#x8FD9;&#x4E9B;&#x5E93;&#x5DF2;&#x7ECF;&#x652F;&#x6301;HarmonyOS&#x6216;OpenHarmony&#xFF0C;&#x6BD4;&#x5982;<a href="https://github.com/OpenFlutter/fluwx" target="_blank">fluwx</a>&#x3002;</p>
<h3 id="&#x5C06;-package-&#x4F9D;&#x8D56;&#x6DFB;&#x52A0;&#x5230;&#x5E94;&#x7528;"><a name="&#x5C06;-package-&#x4F9D;&#x8D56;&#x6DFB;&#x52A0;&#x5230;&#x5E94;&#x7528;" class="plugin-anchor" href="#&#x5C06;-package-&#x4F9D;&#x8D56;&#x6DFB;&#x52A0;&#x5230;&#x5E94;&#x7528;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5C06; package &#x4F9D;&#x8D56;&#x6DFB;&#x52A0;&#x5230;&#x5E94;&#x7528;</h3>
<p>&#x8981;&#x5C06; package &apos;fluttertoast&apos; &#x6DFB;&#x52A0;&#x5230;&#x5E94;&#x7528;&#xFF1A;</p>
<ol>
<li><p><strong>&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;</strong></p>
<p>&#x6253;&#x5F00;&#x5E94;&#x7528;&#x6587;&#x4EF6;&#x5939;&#x4E0B;&#x7684; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#xFF0C;&#x7136;&#x540E;&#x5728; <code>pubspec.yaml</code> &#x4E0B;&#x6DFB;&#x52A0; <code>fluttertoast:</code>&#x3002;</p>
</li>
<li><p><strong>&#x5B89;&#x88C5;</strong></p>
<p>&#x5728;&#x547D;&#x4EE4;&#x884C;&#x4E2D;&#x8FD0;&#x884C;&#xFF1A;<code>flutter pub get</code><strong>&#x6216;&#x8005;</strong>&#x5728; VS Code &#x4E2D;&#x70B9;&#x51FB;&#x4F4D;&#x4E8E; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x9876;&#x90E8;&#x64CD;&#x4F5C;&#x529F;&#x80FD;&#x533A;&#x53F3;&#x4FA7;&#x7684; <strong>Get Packages</strong></p>
</li>
<li><p><strong>&#x5BFC;&#x5165;</strong></p>
<p>&#x5728; Dart &#x4EE3;&#x7801;&#x4E2D;&#x6DFB;&#x52A0;&#x76F8;&#x5173;&#x7684; <code>import</code> &#x8BED;&#x53E5;&#x3002;</p>
</li>
<li><p><strong>&#x5982;&#x679C;&#x6709;&#x5FC5;&#x8981;&#xFF0C;&#x505C;&#x6B62;&#x5E76;&#x91CD;&#x542F;&#x5E94;&#x7528;</strong></p>
<ul>
<li>&#x5982;&#x679C; package &#x5185;&#x6709;&#x7279;&#x5B9A;&#x5E73;&#x53F0;&#x7684;&#x4EE3;&#x7801;&#xFF08;HarmonyOS&#x6216;OpenHarmon &#x7684; ArkTS, iOS &#x7684; Swift/Objective-C&#xFF09;&#xFF0C;&#x4EE3;&#x7801;&#x5FC5;&#x987B;&#x5185;&#x7F6E;&#x5230;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x5185;&#x3002;&#x70ED;&#x91CD;&#x8F7D;&#x548C;&#x70ED;&#x91CD;&#x542F;&#x53EA;&#x5BF9; package &#x7684; Dart &#x4EE3;&#x7801;&#x6267;&#x884C;&#x6B64;&#x64CD;&#x4F5C;&#xFF0C;&#x6240;&#x4EE5;&#x4F60;&#x9700;&#x8981;&#x5B8C;&#x5168;&#x91CD;&#x542F;&#x5E94;&#x7528;&#x4EE5;&#x907F;&#x514D;&#x4F7F;&#x7528; package &#x65F6;&#x51FA;&#x73B0; <code>MissingPluginException</code> &#x9519;&#x8BEF;&#x3002;</li>
</ul>
</li>
</ol>
<h3 id="&#x51B2;&#x7A81;&#x89E3;&#x51B3;"><a name="&#x51B2;&#x7A81;&#x89E3;&#x51B3;" class="plugin-anchor" href="#&#x51B2;&#x7A81;&#x89E3;&#x51B3;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x51B2;&#x7A81;&#x89E3;&#x51B3;</h3>
<p>&#x5047;&#x8BBE;&#x4F60;&#x60F3;&#x5728;&#x5E94;&#x7528;&#x4E2D;&#x4F7F;&#x7528; <code>some_package</code> &#x548C; <code>other_package</code>&#xFF0C;&#x5E76;&#x4E14;&#x5B83;&#x4EEC;&#x4F9D;&#x8D56;&#x4E8E;&#x4E0D;&#x540C;&#x7248;&#x672C;&#x7684; <code>fluttertoast</code>&#x3002;&#x4E8E;&#x662F;&#x6211;&#x4EEC;&#x4FBF;&#x6709;&#x4E86;&#x6F5C;&#x5728;&#x7684;&#x51B2;&#x7A81;&#x3002;&#x907F;&#x514D;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x7684;&#x6700;&#x597D;&#x65B9;&#x6CD5;&#x662F; package &#x7684;&#x4F5C;&#x8005;&#x5728;&#x6307;&#x5B9A;&#x4F9D;&#x8D56;&#x9879;&#x65F6;&#x4F7F;&#x7528; <a href="https://dart.cn/tools/pub/dependencies#version-constraints" target="_blank">&#x7248;&#x672C;&#x8303;&#x56F4;</a> &#x800C;&#x975E;&#x7279;&#x5B9A;&#x7248;&#x672C;&#x3002;</p>
<pre><code class="lang-yaml"><span class="hljs-attr">dependencies:</span>
<span class="hljs-attr">  fluttertoast:</span> ^<span class="hljs-number">5.4</span><span class="hljs-number">.0</span>    <span class="hljs-comment"># Good, any version &gt;= 5.4.0 but &lt; 6.0.0</span>
<span class="hljs-attr">  image_picker:</span> <span class="hljs-string">&apos;5.4.3&apos;</span>   <span class="hljs-comment"># Not so good, only version 5.4.3 works.</span>
</code></pre>
<p>&#x5982;&#x679C; <code>some_package</code> &#x58F0;&#x660E;&#x4E86;&#x4EE5;&#x4E0A;&#x4F9D;&#x8D56;&#xFF0C;&#x5E76;&#x4E14; <code>another_package</code> &#x58F0;&#x660E;&#x4E86;&#x4E00;&#x4E2A;&#x517C;&#x5BB9;&#x7684; <code>fluttertoast</code> &#x4F9D;&#x8D56;&#x9879;&#xFF0C;&#x5982; <code>&apos;5.4.6&apos;</code> &#x6216; <code>^5.5.0</code>&#xFF0C; pub &#x80FD;&#x591F;&#x81EA;&#x52A8;&#x89E3;&#x51B3;&#x51B2;&#x7A81;&#x95EE;&#x9898;&#x3002;</p>
<p>&#x5373;&#x4F7F; <code>some_package</code> &#x548C; <code>another_package</code> &#x58F0;&#x660E;&#x4E86;&#x4E0D;&#x517C;&#x5BB9;&#x7684; <code>fluttertoast</code> &#x7248;&#x672C;&#xFF0C;&#x5B83;&#x4EEC;&#x5B9E;&#x9645;&#x4E0A;&#x4ECD;&#x53EF;&#x80FD;&#x4EE5;&#x517C;&#x5BB9;&#x7684;&#x65B9;&#x5F0F;&#x4F7F;&#x7528; <code>fluttertoast</code>&#x3002;&#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x53EF;&#x5728; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x4E2D;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x4F9D;&#x8D56;&#x8986;&#x76D6;&#x58F0;&#x660E;&#x6765;&#x5F3A;&#x5236;&#x4F7F;&#x7528;&#x7279;&#x5B9A;&#x7248;&#x672C;&#xFF0C;&#x4ECE;&#x800C;&#x5904;&#x7406;&#x51B2;&#x7A81;&#x3002;</p>
<p>&#x4E3A;&#x4E86;&#x5F3A;&#x5236;&#x4F7F;&#x7528;&#x7248;&#x672C;&#x4E3A; <code>8.2.11</code> &#x7684; <code>fluttertoast</code>&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x5BF9;&#x5E94;&#x7528;&#x7684; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x505A;&#x5982;&#x4E0B;&#x66F4;&#x6539;&#xFF1A;</p>
<pre><code class="lang-yaml"><span class="hljs-attr">dependencies:</span>
<span class="hljs-attr">  some_package:</span>
<span class="hljs-attr">  another_package:</span>
<span class="hljs-attr">dependency_overrides:</span>
<span class="hljs-attr">  fluttertoast:</span> <span class="hljs-string">&apos;8.2.11&apos;</span>
</code></pre>
<h2 id="&#x4E09;&#x3001;&#x7BA1;&#x7406;-package-&#x7684;&#x4F9D;&#x8D56;&#x548C;&#x7248;&#x672C;"><a name="&#x4E09;&#x3001;&#x7BA1;&#x7406;-package-&#x7684;&#x4F9D;&#x8D56;&#x548C;&#x7248;&#x672C;" class="plugin-anchor" href="#&#x4E09;&#x3001;&#x7BA1;&#x7406;-package-&#x7684;&#x4F9D;&#x8D56;&#x548C;&#x7248;&#x672C;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E09;&#x3001;&#x7BA1;&#x7406; package &#x7684;&#x4F9D;&#x8D56;&#x548C;&#x7248;&#x672C;</h2>
<p>&#x4E3A;&#x4E86;&#x4F7F;&#x7248;&#x672C;&#x51B2;&#x7A81;&#x7684;&#x98CE;&#x9669;&#x6700;&#x5C0F;&#x5316;&#xFF0C;&#x8BF7;&#x5728; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x4E2D;&#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x7248;&#x672C;&#x8303;&#x56F4;&#x3002;</p>
<h3 id="package-&#x7248;&#x672C;"><a name="package-&#x7248;&#x672C;" class="plugin-anchor" href="#package-&#x7248;&#x672C;"><i class="fa fa-link" aria-hidden="true"></i></a>Package &#x7248;&#x672C;</h3>
<p>&#x6240;&#x6709; package &#x90FD;&#x6709;&#x4E00;&#x4E2A;&#x7248;&#x672C;&#x53F7;&#xFF0C;&#x5728;&#x5B83;&#x4EEC;&#x7684; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x4E2D;&#x6307;&#x5B9A;&#x3002;&#x5F53;&#x524D;&#x7684; package &#x7248;&#x672C;&#x4F1A;&#x5728;&#x5176;&#x540D;&#x79F0;&#x65C1;&#x8FB9;&#x663E;&#x793A;&#x5F53;&#x524D;&#x7248;&#x672C;&#x53F7;&#x3002;&#xFF08;&#x4F8B;&#x5982;&#xFF0C;&#x53C2;&#x9605; <a href="https://pub-web.flutter-io.cn/packages/fluttertoast" target="_blank"><code>fluttertoast</code></a> package&#xFF09;&#x4EE5;&#x53CA;&#x6240;&#x6709;&#x5148;&#x524D;&#x7248;&#x672C;&#x7684;&#x5217;&#x8868;&#xFF1A; <a href="https://pub-web.flutter-io.cn/packages/fluttertoast/versions" target="_blank">fluttertoast &#x7248;&#x672C;&#x5217;&#x8868;</a>&#x3002;</p>
<p>&#x4E3A;&#x4E86;&#x786E;&#x4FDD;&#x5728;&#x66F4;&#x65B0; package &#x7684;&#x65F6;&#x5019;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x4E0D;&#x4F1A;&#x5D29;&#x6E83;&#xFF0C;&#x6211;&#x4EEC;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x683C;&#x5F0F;&#x4E4B;&#x4E00;&#x6765;&#x6307;&#x5B9A;&#x7248;&#x672C;&#x8303;&#x56F4;&#xFF1A;</p>
<p><strong>&#x8303;&#x56F4;&#x9650;&#x5236;&#xFF1A;</strong>&#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x6700;&#x5C0F;&#x548C;&#x6700;&#x5927;&#x7684;&#x7248;&#x672C;&#x53F7;&#x3002;</p>
<pre><code class="lang-yaml"><span class="hljs-attr">dependencies:</span>
<span class="hljs-attr">  fluttertoast:</span> <span class="hljs-string">&apos;&gt;=8.2.0 &lt;8.2.11&apos;</span>
</code></pre>
<p><strong>&#x4F7F;&#x7528; <a href="https://dart.cn/tools/pub/dependencies#caret-syntax" target="_blank">caret&#x8BED;&#x6CD5;</a> &#x7684;&#x8303;&#x56F4;&#x7EA6;&#x675F;&#xFF1A;</strong> &#x6307;&#x5B9A;&#x6700;&#x5C0F;&#x7248;&#x672C;&#xFF0C;&#x8FD9;&#x5305;&#x62EC;&#x4ECE;&#x8BE5;&#x7248;&#x672C;&#x5230;&#x4E0B;&#x4E00;&#x4E2A;&#x4E3B;&#x8981;&#x7248;&#x672C;&#x7684;&#x6240;&#x6709;&#x7248;&#x672C;&#x3002;</p>
<pre><code class="lang-yaml"><span class="hljs-attr">dependencies:</span>
<span class="hljs-attr">  fluttertoast:</span> <span class="hljs-string">&apos;^8.2.11&apos;</span>
</code></pre>
<p>&#x8BE5;&#x8BED;&#x6CD5;&#x4E0E;&#x7B2C;&#x4E00;&#x9879;&#x4E2D;&#x7684;&#x8BED;&#x6CD5;&#x542B;&#x4E49;&#x76F8;&#x540C;&#x3002;</p>
<h3 id="&#x66F4;&#x65B0;-package-&#x4F9D;&#x8D56;"><a name="&#x66F4;&#x65B0;-package-&#x4F9D;&#x8D56;" class="plugin-anchor" href="#&#x66F4;&#x65B0;-package-&#x4F9D;&#x8D56;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x66F4;&#x65B0; package &#x4F9D;&#x8D56;</h3>
<p>&#x5F53;&#x6DFB;&#x52A0; package &#x540E;&#x9996;&#x6B21;&#x8FD0;&#x884C; <code>flutter pub get</code> &#x65F6;&#xFF0C; Flutter &#x5C06;&#x4F1A;&#x4FDD;&#x5B58;&#x5728; <code>pubspec.lock</code> <a href="https://dart.cn/tools/pub/glossary#lockfile" target="_blank">lockfile</a> &#x4E2D;&#x627E;&#x5230;&#x7684;&#x5177;&#x4F53; package &#x7248;&#x672C;&#x3002;&#x8FD9;&#x5C06;&#x786E;&#x4FDD;&#x5F53;&#x4F60;&#x6216;&#x8005;&#x56E2;&#x961F;&#x4E2D;&#x5176;&#x4ED6;&#x5F00;&#x53D1;&#x8005;&#x8FD0;&#x884C; <code>flutter pub get</code> &#x540E;&#x80FD;&#x5F97;&#x5230;&#x76F8;&#x540C;&#x7248;&#x672C;&#x7684; package&#x3002;</p>
<p>&#x5982;&#x679C;&#x4F60;&#x60F3;&#x5347;&#x7EA7;&#x5230; package &#x7684;&#x6700;&#x65B0;&#x7248;&#x672C;&#xFF0C;&#x6BD4;&#x5982;&#x4F7F;&#x7528; package &#x7684;&#x6700;&#x65B0;&#x7279;&#x6027;&#xFF0C;&#x8BF7;&#x8FD0;&#x884C; <code>flutter pub upgrade</code>&#x3002;&#x8FD9;&#x5C06;&#x68C0;&#x7D22;&#x4F60;&#x5728; <code>pubspec.yaml</code> &#x6587;&#x4EF6;&#x4E2D;&#x6307;&#x5B9A;&#x7684;&#x7248;&#x672C;&#x7EA6;&#x675F;&#x6240;&#x5141;&#x8BB8;&#x7684;&#x6700;&#x9AD8;&#x53EF;&#x7528;&#x7248;&#x672C;&#x3002;&#x8BF7;&#x6CE8;&#x610F;&#xFF0C;<code>flutter upgrade</code> &#x4E0E; <code>flutter update-packages</code> &#x662F;&#x4E24;&#x4E2A;&#x4E0D;&#x540C;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x4F46;&#x5B83;&#x4EEC;&#x90FD;&#x4F1A;&#x66F4;&#x65B0; Flutter&#x3002;</p>
<h3 id="&#x4F9D;&#x8D56;&#x672A;&#x53D1;&#x5E03;&#x7684;-package"><a name="&#x4F9D;&#x8D56;&#x672A;&#x53D1;&#x5E03;&#x7684;-package" class="plugin-anchor" href="#&#x4F9D;&#x8D56;&#x672A;&#x53D1;&#x5E03;&#x7684;-package"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F9D;&#x8D56;&#x672A;&#x53D1;&#x5E03;&#x7684; package</h3>
<p>&#x5373;&#x4F7F;&#x672A;&#x5728; Pub site &#x4E0A;&#x53D1;&#x5E03;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; package&#x3002;&#x5BF9;&#x4E8E;&#x4E0D;&#x7528;&#x4E8E;&#x516C;&#x5F00;&#x53D1;&#x5E03;&#x7684;&#x79C1;&#x6709;&#x63D2;&#x4EF6;&#xFF0C;&#x6216;&#x8005;&#x5C1A;&#x672A;&#x51C6;&#x5907;&#x597D;&#x53D1;&#x5E03;&#x7684; package&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5176;&#x4ED6;&#x4F9D;&#x8D56;&#x9009;&#x9879;&#x3002;</p>
<h4 id="path-&#x4F9D;&#x8D56;"><a name="path-&#x4F9D;&#x8D56;" class="plugin-anchor" href="#path-&#x4F9D;&#x8D56;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>Path &#x4F9D;&#x8D56;</strong></h4>
<p>Flutter &#x5E94;&#x7528;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>path:</code> &#x4F9D;&#x8D56;&#x800C;&#x4F9D;&#x8D56;&#x4E8E;&#x63D2;&#x4EF6;&#x3002;&#x8DEF;&#x5F84;&#x53EF;&#x4EE5;&#x662F;&#x76F8;&#x5BF9;&#x7684;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x7EDD;&#x5BF9;&#x7684;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x8981;&#x4F9D;&#x8D56;&#x4F4D;&#x4E8E;&#x5E94;&#x7528;&#x76F8;&#x90BB;&#x76EE;&#x5F55;&#x4E2D;&#x7684;&#x63D2;&#x4EF6; <code>plugin1</code>&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x8BED;&#x6CD5;&#xFF1A;</p>
<pre><code>dependencies:
  packageA:
    path: ../packageA/
</code></pre><h4 id="git-&#x4F9D;&#x8D56;"><a name="git-&#x4F9D;&#x8D56;" class="plugin-anchor" href="#git-&#x4F9D;&#x8D56;"><i class="fa fa-link" aria-hidden="true"></i></a><strong>Git &#x4F9D;&#x8D56;</strong></h4>
<p>&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x4F9D;&#x8D56;&#x5B58;&#x50A8;&#x5728; Git &#x4ED3;&#x5E93;&#x4E2D;&#x7684; package&#xFF0C;&#x5982;&#x679C; package &#x4F4D;&#x4E8E;&#x4ED3;&#x5E93;&#x7684;&#x6839;&#x76EE;&#x5F55;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x8BED;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-yaml"><span class="hljs-attr">  dependencies:</span>
<span class="hljs-attr">    fluttertoast:</span>
<span class="hljs-attr">      git:</span>
<span class="hljs-attr">        url:</span> https://gitcode.com/nutpi/FlutterToast.git
</code></pre>
<h4 id="&#x901A;&#x8FC7;-ssh-&#x4F9D;&#x8D56;-git-package"><a name="&#x901A;&#x8FC7;-ssh-&#x4F9D;&#x8D56;-git-package" class="plugin-anchor" href="#&#x901A;&#x8FC7;-ssh-&#x4F9D;&#x8D56;-git-package"><i class="fa fa-link" aria-hidden="true"></i></a><strong>&#x901A;&#x8FC7; SSH &#x4F9D;&#x8D56; Git package</strong></h4>
<p>&#x5982;&#x679C;&#x4F60;&#x9700;&#x8981;&#x901A;&#x8FC7; SSH &#x8FDE;&#x63A5;&#x79C1;&#x6709;&#x7684;&#x4ED3;&#x5E93;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x7528; SSH &#x94FE;&#x63A5;&#x4F9D;&#x8D56;&#x5BF9;&#x5E94;&#x7684; package&#xFF1A;</p>
<pre><code class="lang-yaml"><span class="hljs-attr">  dependencies:</span>
<span class="hljs-attr">    fluttertoast:</span>
<span class="hljs-attr">      git:</span>
<span class="hljs-attr">        url:</span> git@gitcode.com:nutpi/FlutterToast.git
</code></pre>
<h4 id="git-&#x4F9D;&#x8D56;&#x4E8E;&#x6587;&#x4EF6;&#x5939;&#x4E2D;&#x7684;-package-"><a name="git-&#x4F9D;&#x8D56;&#x4E8E;&#x6587;&#x4EF6;&#x5939;&#x4E2D;&#x7684;-package-" class="plugin-anchor" href="#git-&#x4F9D;&#x8D56;&#x4E8E;&#x6587;&#x4EF6;&#x5939;&#x4E2D;&#x7684;-package-"><i class="fa fa-link" aria-hidden="true"></i></a><strong>Git &#x4F9D;&#x8D56;&#x4E8E;&#x6587;&#x4EF6;&#x5939;&#x4E2D;&#x7684; package </strong></h4>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;pub &#x4F1A;&#x9ED8;&#x8BA4;&#x5047;&#x5B9A; package &#x4F4D;&#x4E8E; Git &#x4ED3;&#x5E93;&#x7684;&#x6839;&#x76EE;&#x5F55;&#x3002;&#x5982;&#x679C;&#x4E0D;&#x662F;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>path</code> &#x53C2;&#x6570;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;</p>
<pre><code class="lang-yaml"><span class="hljs-attr">dependencies:</span>
<span class="hljs-attr">  fluttertoast:</span>
<span class="hljs-attr">    git:</span>
<span class="hljs-attr">      url:</span> https://gitcode.com/nutpi/FlutterToast.git
<span class="hljs-attr">      path:</span> packages/fluttertoast
</code></pre>
<p>&#x6700;&#x540E;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>ref</code> &#x53C2;&#x6570;&#x5C06;&#x4F9D;&#x8D56;&#x56FA;&#x5B9A;&#x5230; git &#x7279;&#x5B9A;&#x7684; commit&#x3001;branch &#x6216;&#x8005; tag&#x3002;&#x6BD4;&#x5982;</p>
<h4 id="branch"><a name="branch" class="plugin-anchor" href="#branch"><i class="fa fa-link" aria-hidden="true"></i></a>branch</h4>
<pre><code>dependencies:
  fluttertoast:
    git:
      url: https://gitcode.com/nutpi/FlutterToast.git
      ref: main # &#x6216;&#x8005; null-safety &#x6216;&#x5176;&#x4ED6;&#x5206;&#x652F;&#x540D;
</code></pre><h4 id="commit"><a name="commit" class="plugin-anchor" href="#commit"><i class="fa fa-link" aria-hidden="true"></i></a>commit</h4>
<pre><code>dependencies:
  fluttertoast:
    git:
      url: https://gitcode.com/nutpi/FlutterToast.git
      ref: 6a7a2c69910f216c01d581c57cd13b5717a1432f
</code></pre><h4 id="tag"><a name="tag" class="plugin-anchor" href="#tag"><i class="fa fa-link" aria-hidden="true"></i></a>tag</h4>
<pre><code>dependencies:
  fluttertoast:
    git:
      url: https://gitcode.com/nutpi/FlutterToast.git
      ref: v1.0.0 # &#x66FF;&#x6362;&#x4E3A;&#x5B9E;&#x9645;&#x5B58;&#x5728;&#x7684;&#x6807;&#x7B7E;&#x540D;
</code></pre><h2 id="&#x53C2;&#x8003;"><a name="&#x53C2;&#x8003;" class="plugin-anchor" href="#&#x53C2;&#x8003;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x53C2;&#x8003;</h2>
<ul>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5982;&#x4F55;&#x4F7F;&#x7528;Flutter&#x4E0E;OpenHarmony&#x901A;&#x4FE1; FlutterChannel.md" target="_blank">&#x5982;&#x4F55;&#x4F7F;&#x7528;Flutter&#x4E0E;OpenHarmony&#x901A;&#x4FE1; FlutterChannel</a></li>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5982;&#x4F55;&#x4F7F;&#x7528;&#x6DF7;&#x5408;&#x5F00;&#x53D1; module.md" target="_blank">&#x5F00;&#x53D1;module</a></li>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5F00;&#x53D1;package.md" target="_blank">&#x5F00;&#x53D1;package</a></li>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5F00;&#x53D1;plugin.md" target="_blank">&#x5F00;&#x53D1;plugin</a></li>
<li><a href="https://gitcode.com/openharmony-sig/flutter_samples/blob/master/ohos/docs/04_development/&#x5F00;&#x53D1;FFI plugin.md" target="_blank">&#x5F00;&#x53D1;FFI plugin</a></li>
<li><a href="https://dart.cn/tools/pub/dependencies" target="_blank">Package dependencies</a></li>
</ul>
<h2 id="&#x575A;&#x679C;&#x6D3E;"><a name="&#x575A;&#x679C;&#x6D3E;" class="plugin-anchor" href="#&#x575A;&#x679C;&#x6D3E;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x575A;&#x679C;&#x6D3E;</h2>
<p>&#x575A;&#x679C;&#x6D3E;&#x7531;&#x575A;&#x679C;&#x7B49;&#x4EBA;&#x521B;&#x5EFA;&#xFF0C;&#x56E2;&#x961F;&#x62E5;&#x6709;&#x82E5;&#x5E72;&#x534E;&#x4E3A;HDE&#xFF0C;&#x4EE5;&#x53CA;&#x82E5;&#x5E72;&#x5176;&#x4ED6;&#x9886;&#x57DF;&#x7684;&#x4E09;&#x5341;&#x4F59;&#x4F4D;&#x4E07;&#x7C89;&#x535A;&#x4E3B;&#x8FD0;&#x8425;&#x3002;&#x4E13;&#x6CE8;&#x4E8E;&#x5206;&#x4EAB;&#x7684;&#x6280;&#x672F;&#x5305;&#x62EC;HarmonyOS/OpenHarmony&#xFF0C;ArkUI-X&#xFF0C;&#x5143;&#x670D;&#x52A1;&#xFF0C;&#x670D;&#x52A1;&#x5361;&#x7247;&#xFF0C;&#x534E;&#x4E3A;&#x81EA;&#x7814;&#x8BED;&#x8A00;&#xFF0C;BlueOS&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x3001;&#x56E2;&#x961F;&#x6210;&#x5458;&#x805A;&#x96C6;&#x5728;&#x5317;&#x4EAC;&#x3001;&#x4E0A;&#x6D77;&#x3001;&#x5E7F;&#x5DDE;&#x3001;&#x6DF1;&#x5733;&#x3001;&#x5357;&#x4EAC;&#x3001;&#x676D;&#x5DDE;&#x3001;&#x82CF;&#x5DDE;&#x3001;&#x5B81;&#x590F;&#x7B49;&#x5730;&#x3002; &#x805A;&#x7126;&#x201C;&#x9E3F;&#x8499;&#x539F;&#x751F;&#x5E94;&#x7528;&#x201D;&#x3001;&#x201C;&#x667A;&#x80FD;&#x7269;&#x8054;&#x201D;&#x548C;&#x201C;AI&#x8D4B;&#x80FD;&#x201D;&#x3001;&#x201C;&#x4EBA;&#x5DE5;&#x667A;&#x80FD;&#x201D;&#x56DB;&#x5927;&#x4E1A;&#x52A1;&#x9886;&#x57DF;&#xFF0C;&#x4F9D;&#x6258;&#x534E;&#x4E3A;&#x5F00;&#x53D1;&#x8005;&#x4E13;&#x5BB6;&#x7B49;&#x5F3A;&#x5927;&#x7684;&#x6280;&#x672F;&#x56E2;&#x961F;&#xFF0C;&#x4EE5;&#x53CA;&#x6DB5;&#x76D6;&#x9700;&#x6C42;&#x3001;&#x5F00;&#x53D1;&#x3001;&#x6D4B;&#x8BD5;&#x3001;&#x8FD0;&#x7EF4;&#x4E8E;&#x4E00;&#x4F53;&#x7684;&#x7EFC;&#x5408;&#x670D;&#x52A1;&#x4F53;&#x7CFB;&#xFF0C;&#x8D4B;&#x80FD;&#x6587;&#x65C5;&#x3001;&#x5A92;&#x4F53;&#x3001;&#x793E;&#x4EA4;&#x3001;&#x5BB6;&#x5C45;&#x3001;&#x6D88;&#x8D39;&#x7535;&#x5B50;&#x7B49;&#x884C;&#x4E1A;&#x5BA2;&#x6237;&#xFF0C;&#x6EE1;&#x8DB3;&#x793E;&#x533A;&#x5BA2;&#x6237;&#x6570;&#x5B57;&#x5316;&#x5347;&#x7EA7;&#x8F6C;&#x578B;&#x7684;&#x9700;&#x6C42;&#xFF0C;&#x5E2E;&#x52A9;&#x5BA2;&#x6237;&#x5B9E;&#x73B0;&#x4EF7;&#x503C;&#x63D0;&#x5347;&#x3002; &#x76EE;&#x524D;&#x4E0A;&#x67B6;&#x9E3F;&#x8499;&#x539F;&#x751F;&#x5E94;&#x7528;18&#x6B3E;&#xFF0C;&#x4E09;&#x65B9;&#x5E93;72&#x4E2A;&#x3002;</p>
<p>&#x5730;&#x5740;&#xFF1A;<a href="https://atomgit.com/nutpi" target="_blank">https://atomgit.com/nutpi</a></p>
<p><a href="https://gitcode.com/nutpi" target="_blank">https://gitcode.com/nutpi</a></p>
<h2 id="&#x603B;&#x7ED3;"><a name="&#x603B;&#x7ED3;" class="plugin-anchor" href="#&#x603B;&#x7ED3;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x603B;&#x7ED3;</h2>
<p>&#x672C;&#x6587;&#x662F;&#x4E00;&#x7BC7;&#x5173;&#x4E8E;&#x5982;&#x4F55;&#x5728;&#x9E3F;&#x8499;&#x7248; Flutter &#x5F00;&#x53D1;&#x4E2D;&#x6709;&#x6548;&#x4F7F;&#x7528; Packages &#x7684;&#x6280;&#x672F;&#x6307;&#x5357;&#x3002;&#x6587;&#x7AE0;&#x63D0;&#x4F9B;&#x4E86;&#x4ECE;&#x57FA;&#x7840;&#x6982;&#x5FF5;&#x5230;&#x9AD8;&#x7EA7;&#x7BA1;&#x7406;&#x6280;&#x5DE7;&#x7684;&#x5168;&#x9762;&#x4ECB;&#x7ECD;&#xFF0C;&#x5E2E;&#x52A9;&#x5F00;&#x53D1;&#x8005;&#x63D0;&#x5347;&#x5F00;&#x53D1;&#x6548;&#x7387;&#x5E76;&#x4E30;&#x5BCC;&#x5E94;&#x7528;&#x529F;&#x80FD;&#x3002;&#x6587;&#x7AE0;&#x5F3A;&#x8C03;&#x4E86;&#x5728;&#x9E3F;&#x8499;&#x7248; Flutter &#x5F00;&#x53D1;&#x4E2D;&#x5408;&#x7406;&#x4F7F;&#x7528; Packages &#x7684;&#x91CD;&#x8981;&#x6027;&#xFF0C;&#x6307;&#x51FA;&#x8FD9;&#x53EF;&#x4EE5;&#x663E;&#x8457;&#x63D0;&#x9AD8;&#x5F00;&#x53D1;&#x6548;&#x7387;&#x548C;&#x5E94;&#x7528;&#x7684;&#x4E30;&#x5BCC;&#x5EA6;&#x3002;&#x901A;&#x8FC7;&#x4F7F;&#x7528; Packages&#xFF0C;&#x5F00;&#x53D1;&#x8005;&#x53EF;&#x4EE5;&#x5229;&#x7528;&#x73B0;&#x6210;&#x7684;&#x4EE3;&#x7801;&#x96C6;&#x5408;&#x6765;&#x5B9E;&#x73B0;&#x7279;&#x5B9A;&#x529F;&#x80FD;&#xFF0C;&#x907F;&#x514D;&#x91CD;&#x590D;&#x9020;&#x8F6E;&#x5B50;&#x3002;&#x6700;&#x540E;&#x6587;&#x7AE0;&#x8BE6;&#x7EC6;&#x4ECB;&#x7ECD;&#x4E86;&#x5982;&#x4F55;&#x5728;&#x9E3F;&#x8499;&#x7248; Flutter &#x4E2D;&#x4F7F;&#x7528; Packages&#xFF0C;&#x5305;&#x62EC;&#x641C;&#x7D22;&#x3001;&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;&#x3001;&#x5BFC;&#x5165;&#x548C;&#x89E3;&#x51B3;&#x51B2;&#x7A81;&#x7684;&#x6B65;&#x9AA4;&#x3002;&#x5E0C;&#x671B;&#x5BF9;&#x5927;&#x5BB6;&#x6709;&#x7528;&#x3002;</p>
<p>&#x901A;&#x8FC7;&#x5408;&#x7406;&#x4F7F;&#x7528; Packages&#xFF0C;&#x9E3F;&#x8499;&#x7248; Flutter &#x5F00;&#x53D1;&#x8005;&#x53EF;&#x4EE5;&#x663E;&#x8457;&#x63D0;&#x9AD8;&#x5F00;&#x53D1;&#x6548;&#x7387;&#xFF0C;&#x521B;&#x5EFA;&#x529F;&#x80FD;&#x66F4;&#x4E30;&#x5BCC;&#x3001;&#x6027;&#x80FD;&#x66F4;&#x7A33;&#x5B9A;&#x7684;&#x5E94;&#x7528;&#x3002;&#x6587;&#x7AE0;&#x63D0;&#x4F9B;&#x7684;&#x8BE6;&#x7EC6;&#x6307;&#x5357;&#x548C;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#xFF0C;&#x4E3A;&#x5F00;&#x53D1;&#x8005;&#x5728;&#x5B9E;&#x9645;&#x9879;&#x76EE;&#x4E2D;&#x5E94;&#x7528;&#x8FD9;&#x4E9B;&#x77E5;&#x8BC6;&#x63D0;&#x4F9B;&#x4E86;&#x575A;&#x5B9E;&#x7684;&#x57FA;&#x7840;&#x3002;</p>
<footer class="page-footer"><span class="copyright">powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2025-04-25 08:54:40
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                </div>
                <script src="https://my.openwrite.cn/js/readmore.js"></script>
                <script>
                    var enablePlugin = false;
                    var allowDomain = "localhost";
                    if(allowDomain){
                        var currentDomain = location.hostname;
                        if ($.isArray(allowDomain)) {
                            $.each(allowDomain, function(index, item) {
                                if (currentDomain == item) {
                                    enablePlugin = true;
                                    return false;
                                }
                            });
                        }else{
                           if (currentDomain == allowDomain) {
                                enablePlugin = true;
                            }
                        }
                    }else{
                        enablePlugin = true;
                    }
                    
                    if(enablePlugin){
                        var isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
                        if (!isMobile) {
                            var btw = new BTWPlugin();
                            btw.init({"allowDomain":"localhost","blogId":"27976-1678928361372-483","name":"坚果派","qrcode":"https://luckly007.oss-cn-beijing.aliyuncs.com/images/image-20230316085818226.png","keyword":"鸿蒙坚果","id":"vip-container"});
                        }
                    }
                </script> 
          </section>
          
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>
 
          <div class="book-footer">
            
            <div class="donate">
              <div></div>
              <button class="donate-btn" onclick="showModal()">赞赏</button>
            </div>
             
            <div class="copyright"></div>
            
          </div>
          
        </div>
      </div>
      
    </div>

        
  </div>
  <script>
    function showModal() {
      document.getElementsByClassName("mask")[0].style.display = "block";
      document.getElementsByClassName("donate-modal")[0].style.display =
        "block";
    }
    // 切换赞赏码
    function showDonateImg(num) {
      let alipay = "";
      let wxpay = ""
      if(num){
        wxpay = "hidden"
      }else{
        alipay = "hidden"
      }
      document.getElementById("wxpay-code").hidden = wxpay;
      document.getElementById("alipay-code").hidden = alipay;
      document.getElementsByName("pay-way")[num].checked = "checked";
    }

    // 关闭赞赏框
    function closeDonateModal() {
      document.getElementsByClassName("mask")[0].style.display = "none";
      document.getElementsByClassName("donate-modal")[0].style.display = "none";
    }

    var gitbook = gitbook || [];
    gitbook.push(function () {
      gitbook.page.hasChanged({"page":{"title":"11.1高效使用 Packages指南","level":"1.11.1","depth":2,"next":{"title":"11.2发布Packages","level":"1.11.2","depth":2,"ref":"","articles":[]},"previous":{"title":"11.Packages使用指南","level":"1.11","depth":1,"ref":"","articles":[{"title":"11.1高效使用 Packages指南","level":"1.11.1","depth":2,"path":"chapter11/11.1高效使用 Packages指南.md","ref":"./chapter11/11.1高效使用 Packages指南.md","articles":[]},{"title":"11.2发布Packages","level":"1.11.2","depth":2,"ref":"","articles":[]}]},"dir":"ltr"},"config":{"plugins":["github-buttons@2.1.0","edit-link","splitter","tbfed-pagefooter","expandable-chapters","chapter-fold","back-to-top-button","code","pageview-count","popup","search-plus","-lunr","-search","splitter","-sharing","sharing-plus","theme-lou","mind-maps","emphasize","anchors","changyan","readmore","livereload","ace","livereload"],"root":".","styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"pluginsConfig":{"expandable-chapters":{}},"emphasize":{},"ace":{},"livereload":{},"splitter":{},"readmore":{"allowDomain":"localhost","blogId":"27976-1678928361372-483","name":"坚果派","qrcode":"https://luckly007.oss-cn-beijing.aliyuncs.com/images/image-20230316085818226.png","keyword":"鸿蒙坚果"},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"popup":{},"code":{"copyButtons":true},"theme-lou":{"hide-elements":[".summary .gitbook-link",".summary .divider"],"color":"#FF4848","book-anchor-title":"本章目录","copyright":{"author":"vx:nut_pie"},"forbidCopy":true,"logo":"assets/avatar.png","book-summary-title":"文章目录","search-placeholder":"输入关键字搜索","copyrightLogo":"assets/copyright.png","favicon":"assets/avatar.png","appleTouchIconPrecomposed152":"assets/avatar.png"},"changyan":{"appid":"cyvHoCPAs","conf":"0440cfc4168ba95d73cfc52dd4d5c60b"},"fontsettings":{"theme":"white","family":"sans","size":2},"mind-maps":{},"highlight":{},"back-to-top-button":{},"pageview-count":{},"github-buttons":{"repo":"ITmxs/gitbook","types":["star","watch","fork"],"size":"small"},"sharing":{"qq":false,"all":["qq","qzone","whatsapp","douban","facebook","google","instapaper","linkedin","messenger","twitter","weibo"],"douban":false,"facebook":false,"weibo":false,"twitter":false,"pocket":false,"google":false,"qzone":false},"edit-link":{"label":"编辑此页","base":"https://github.com/ITmxs/gitbook/edit/master/"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"坚果派","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"themeLou":{"nav":[{"target":"_blank","url":"https://www.gitbook.com/","name":"坚果派官网"},{"target":"_blank","url":"https://www.npmjs.com/package/package","name":"ArkUI实战"},{"target":"_blank","url":"https://space.bilibili.com/480883651","name":"元服务开发实践"},{"target":"_blank","url":"https://blog.51cto.com/jianguo","name":"OpenHarmony应用开发"}],"footer":{"donate":{"wechat":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png","message":"随意打赏，但不要超过一顿早餐钱 💕","wxpay":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202901895.png","alipay":"https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210922202843746.png","nickname":"breeze","button":"打赏","wechatText":"微信","alipayText":"支付宝","title":"『赠人玫瑰 🌹 手有余香 』","avatar":"http://xkapp-uat.oss-cn-hangzhou.aliyuncs.com/2e7a3f70-80ab-4b50-93ec-a04dfeef949b/avatar-100.png"},"copyright":true}}},"title":"Flutter for Harmony教程","language":"zh-hans","gitbook":"*","description":"Flutter for Harmony电子书教程"},"file":{"path":"chapter11/11.1高效使用 Packages指南.md","mtime":"2025-04-25T00:54:40.728Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2025-05-22T05:24:30.737Z"},"basePath":"..","book":{"language":""}});
    });
  </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-mind-maps/mindmaps.dist.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-changyan/changyan.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-lou/lou.js"></script>
        
    

    </body>
</html>

